Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential race condition in the Options system #5535

Merged
merged 2 commits into from
Dec 2, 2022

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented Dec 2, 2022

Fixes #5430
Fixes #5533

We think that this small change avoids a race condition in the Options system where the garbage collector cleans up a weakref in this line:

max_id = max(store_ids)+1 if len(store_ids) > 0 else 0

It should not cause any other issues, because this would have been used when Python 2 was supported, at the time .keys() was returning a list. We may encounter this sort of issue in other places, if we don't handle weakrefs properly?

@maximlt
Copy link
Member Author

maximlt commented Dec 2, 2022

Failing on 3.11 for unrelated reasons, merging.

@maximlt maximlt merged commit 0317237 into master Dec 2, 2022
@maximlt maximlt deleted the workaround_weakref branch December 2, 2022 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant